using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class PackageMap : EntityTypeConfiguration<Package>
	{
		public PackageMap()
		{
			// Primary Key
			this.HasKey(t => t.PackageID);

			// Properties
			this.Property(t => t.PackageNO)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.CarNum)
				.HasMaxLength(10);
				
			// Table & Column Mappings
			this.ToTable("Package");
			this.Property(t => t.PackageID).HasColumnName("PackageID");
			this.Property(t => t.PackageNO).HasColumnName("PackageNO");
			this.Property(t => t.Amount).HasColumnName("Amount");
			this.Property(t => t.PackageNum).HasColumnName("PackageNum");
			this.Property(t => t.Weight).HasColumnName("Weight");
			this.Property(t => t.Operator).HasColumnName("Operator");
			this.Property(t => t.OperateTime).HasColumnName("OperateTime");
			this.Property(t => t.OperateStation).HasColumnName("OperateStation");
			this.Property(t => t.ReceiveStation).HasColumnName("ReceiveStation");
			this.Property(t => t.ReceiveBy).HasColumnName("ReceiveBy");
			this.Property(t => t.Driver).HasColumnName("Driver");
			this.Property(t => t.CarNum).HasColumnName("CarNum");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatStation).HasColumnName("CreatStation");
			this.Property(t => t.CreatTime).HasColumnName("CreatTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateStation).HasColumnName("UpdateStation");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.IsDelete1).HasColumnName("IsDelete1");
		}
	}
}

